import { Component, OnInit } from '@angular/core';
import {Hero} from '../hero';
import {Heroc} from '../heroc';
import {HEROES} from '../mock-heroes';
import { HeroService } from '../hero.service';
import { FormGroup, FormControl, Validators } from '@angular/forms';

@Component({
  selector: 'app-heroes',
  templateUrl: './heroes.component.html',
  styleUrls: ['./heroes.component.css']
})
export class HeroesComponent implements OnInit {

  profileForm = new FormGroup({
    firstName: new FormControl('wbz'),
    lastName: new FormControl(''),
    address: new FormGroup(
      {
        city: new FormControl('fuzhou'),
      }
    ),
  });




  
  // hero: Hero = {
  //   id: 1,
  //   name: 'wbzzzz',

  // };

  // submitted = false;

  // powers = ['Really Smart', 'Supser Flexible',
  //   'Super Hot'];

  // model = new Heroc(18, 'Dr IQ', this.powers[0], 'Chuck Overstreet');

  // get diagnostic() { return JSON.stringify(this.model); }

  // heroes: Hero[];
  // heroes2: Hero[];

  // selectedHero: Hero;

  // onSelect(hero: Hero): void {
  //   this.selectedHero = hero;
  // }

  // getHeroes(): void {
  //   this.heroService.getHeroes()
  //       .subscribe(a => {
  //         this.heroes = a;
  //         this.heroes2 = a;
  //       }  )
  // }

  // onSubmit() {
  //   console.log('ok');
  //   this.submitted = true;
  // }

  constructor(private heroService: HeroService) { }

  name = new FormControl('aaa');
  

  
  ngOnInit() {
    // this.getHeroes();

   
  }

}
